import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:xvideos/assets_tool/app_colors.dart';
import 'package:xvideos/assets_tool/images.dart';
import 'package:xvideos/config/config.dart';
import 'package:xvideos/hj_utils/holiday_theme.dart';
import 'package:xvideos/hj_utils/widget_utils.dart';
import 'package:xvideos/tools_base/widget/common_dialog.dart';

class PayKindlyTipsAlert extends StatelessWidget {
  const PayKindlyTipsAlert({super.key});

  @override
  Widget build(BuildContext context) {
    return CommonDialog(
      child: Column(mainAxisSize: MainAxisSize.min, children: [
        Text(
          '温馨提示',
          style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500, color: Colors.white.withOpacity(0.9)),
        ),
        12.sizeBoxH,
        0.5.line,
        12.sizeBoxH,
        Text(
          '''1.订单支付后，一般会在1-10分钟内到账，如超时未到账，请联系在线客服为您处理。\n
2.受特殊行业限制，如支付失败可尝试重新发起订单，系统将会随机切换备用的支付通道。\n
3.本APP有稳定的广告收益，产品稳定安全，请放心充值使用，如遇报毒提示忽略即可。''',
          style: TextStyle(color: Colors.white.withOpacity(.55), fontSize: 12, height: 1.8),
        ),
        12.sizeBoxH,
        _buildTips(),
        22.sizeBoxH,
        GestureDetector(
          onTap: () => Get.back(result: true),
          child: Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(3),
              color: AppColors.actionRed,
            ),
            alignment: Alignment.center,
            height: 44,
            child: Text(
              '确认支付',
              style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.w500),
            ),
          ),
        ),
      ]),
    );
  }

  Widget _buildTips() {
    return Container(
      decoration: BoxDecoration(
        color: Colors.white.withOpacity(.05),
        borderRadius: BorderRadius.circular(8.r),
        border: Border.all(
          width: 1,
          color: Color(0xff6954E7).withOpacity(.3),
        ),
      ),
      width: double.infinity,
      padding: EdgeInsets.all(12.w),
      child: Column(
        children: [
          Row(
            children: [
              Image.asset(
                HolidayTheme.theme.appIcon,
                width: 48.w,
                height: 48.w,
              ),
              10.sizeBoxW,
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      Config.APPNAME,
                      style: TextStyle(color: Colors.white, fontSize: 14.sp, fontWeight: FontWeight.w500),
                    ),
                    4.sizeBoxH,
                    Text(
                      '发现恶意程序请立即处理',
                      style: TextStyle(color: Colors.white.withOpacity(.4), fontSize: 10.sp, fontWeight: FontWeight.w500),
                    ),
                  ],
                ),
              )
            ],
          ),
          12.sizeBoxH,
          Row(
            children: [
              Text(
                '忽略 ',
                style: TextStyle(color: Colors.white.withOpacity(.9), fontSize: 12),
              ),
              Image.asset(
                'tips_arrow_left.png'.mineImgPath,
                color: Colors.white,
                width: 28,
              ),
              Text(
                ' 点击这里',
                style: TextStyle(color: Colors.white.withOpacity(.9), fontSize: 10),
              ),
              Spacer(),
              Text(
                '卸载',
                style: TextStyle(color: Colors.white.withOpacity(.4), fontSize: 10),
              ),
            ],
          )
        ],
      ),
    );
  }
}
